package com.wesley.growth.kafka.wechat.common;

import lombok.Data;

import java.util.UUID;

/**
 * @author : jiangzh
 * @description : 公共返回对象
 **/
@Data
public class BaseResponse<M> {

    private String requestId;
    private M result;

    public static <M> BaseResponse success() {
        BaseResponse baseResponseVO = new BaseResponse();
        baseResponseVO.setRequestId(genRequestId());

        return baseResponseVO;
    }

    public static <M> BaseResponse success(M result) {
        BaseResponse baseResponseVO = new BaseResponse();
        baseResponseVO.setRequestId(genRequestId());
        baseResponseVO.setResult(result);

        return baseResponseVO;
    }

    private static String genRequestId() {
        return UUID.randomUUID().toString();
    }

}
